package leetcode.editor.cn.q1_300.q50;

/**
 * @author qidi
 * @date 2021-12-15 13:09:19
 */
class Q0070_ClimbingStairs {

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int climbStairs(int n) {
            if (n == 1) return 1;
            if (n == 2) return 2;

            int step = 0;
            int i = 2;
            int a = 1;
            int b = 2;
            while (i < n) {
                step = a + b;
                a = b;
                b = step;
                i++;
            }
            return step;
        }
    }
    //leetcode submit region end(Prohibit modification and deletion)


    public static void main(String[] args) {
        Solution solution = new Q0070_ClimbingStairs().new Solution();
        for (int i = 1; i < 9; i++) {
            System.out.println(solution.climbStairs(i));
        }
    }
}